package com.heima.kafka.consumer;

import com.alibaba.fastjson.JSON;
import com.heima.kafka.pojo.User;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * @author ybw
 * @version 1.0
 * @date 2021/12/18 16:27
 */
@Component
public class ConsumerListener {
  @KafkaListener(topics = {"boot-01", "boot-02"})
  public void listener(String message) {
    System.out.println(message);
    User user = JSON.parseObject(message, User.class);
    System.out.println(user);
  }
}
